<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title></title>
</head>
<body>
	
	<button type="button" onclick="getdata()">获取数据</button>
	<div class="content"></div>
	
	<script type="text/javascript">
		
		let con = document.querySelector('.content')
		function getdata(){
			let xhr = new XMLHttpRequest()
			xhr.open('GET','get.php?username=zhangsan&sex=nv')
			xhr.send()
			xhr.onreadystatechange = () => {
				if(xhr.readyState !==4 ) return
				if(xhr.readyState === 4 || xhr.status === 200){
					con.innerHTML = xhr.responseText
				}
			}
		}
		
		
	</script>
</body>
</html>